'-----------------------------------------------------------------------
'  This file is part of the Microsoft Code Samples.
' 
'  Copyright (C) Microsoft Corporation.  All rights reserved.
' 
'  This source code is intended only as a supplement to Microsoft
'  Development Tools and/or on-line documentation.  See these other
'  materials for detailed information regarding Microsoft code samples.
' 
'  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
'  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
'  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'  PARTICULAR PURPOSE.
'-----------------------------------------------------------------------

#Region "Using directives"'
'ToDo: Error processing original source shown below
'{
'    #region Using directives
'-----^--- Syntax error: '}' expected

Imports System
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Collections
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Drawing
Imports System.Windows.Forms
Imports Microsoft.ReportDesigner
Imports Microsoft.ReportDesigner.Design
Imports Microsoft.ReportingServices.Interfaces
Imports System.Xml
Imports System.Xml.Xsl
Imports System.Xml.XPath

#End Region

''' <summary>
''' handle in-place conversion from standard report item to custom report item
''' using the chartconverter XSLT 
''' </summary>
''' <remarks></remarks>
Public Class PolygonsConverter
    Implements IReportItemConverter
    
    Public Function Convert(ByVal reportItem As String, ByVal sp As IServiceProvider) As String Implements IReportItemConverter.Convert
        Dim [assembly] As System.Reflection.Assembly _
            = System.Reflection.Assembly.GetAssembly(GetType(PolygonsConverter))
        Dim stream As System.IO.Stream _
            = [assembly].GetManifestResourceStream("PolygonsCRI.ChartConverter.xslt")
        Dim doc As New XmlDocument()
        doc.LoadXml(reportItem)
        Dim xslt As New XmlDocument()
        xslt.Load(stream)
        Dim xsl As New XslCompiledTransform()
        xsl.Load(xslt)
        Dim result As New System.IO.StringWriter(System.Globalization.CultureInfo.CurrentUICulture)
        xsl.Transform(doc, Nothing, result)
        Dim results As String = result.ToString()
        result.Dispose()
        Return results
    End Function
End Class
